<template>
    <!-- 头部部分 -->
  <header class="header">
    <h1>todos</h1>
    <input class="new-todo" placeholder="请输入任务名称" autofocus @keydown.enter="fn" />
  </header>
</template>

<script>
export default {
  name: 'SrcTodosMyHeader',

  data() {
    return {
      
    };
  },

  mounted() {
    
  },

  methods: {
    fn(e){
      console.log(e.target.value);
      this.$store.dispatch('todos/addList',{
        name:e.target.value,
        done:true
      })
      e.target.value =""
    }
  },
};
</script>